bl = require "bl"
http = require "http"

urls = process.argv[2..]

queue = []
count = 0

printResult = ->
  console.log data for data in queue

HttpGetAsync = (index) ->
  http.get urls[index], (response) ->
    response.pipe bl (error,data) ->
      queue[index] = data.toString()
      count++

      printResult() if count == 3

HttpGetAsync i for i in [0...3]
